
#include <Arduino.h>
extern unsigned char save_data[];
#define INT_LEN 4  //int长度
#define STR_LEN 40 // 保存字符串的最大长度
#define LEN1 22    // int类型个数
#define LEN2 16    // String类型个数

#define START 3000 // eeprom 保存起始位置,给blink留空间
//int
#define TIME_ENABLE_INDEX 0
#define MODE_CHOOSE_INDEX 1

#define MODE1_OPEN_HOUR 2
#define MODE1_OPEN_MINUTE 3
#define MODE1_CLOSE_HOUR 4
#define MODE1_CLOSE_MINUTE 5
#define MODE1_WEEK_0_ENABLE 6  //周日
#define MODE1_WEEK_1_ENABLE 7
#define MODE1_WEEK_2_ENABLE 8 
#define MODE1_WEEK_3_ENABLE 9 
#define MODE1_WEEK_4_ENABLE 10
#define MODE1_WEEK_5_ENABLE 11
#define MODE1_WEEK_6_ENABLE 12

#define MODE2_OPENING_HOUR 13
#define MODE2_OPENING_MINUTE 14
#define MODE2_OPENING_SECOND 15
#define MODE2_CLOSING_HOUR 16
#define MODE2_CLOSING_MINUTE 17
#define MODE2_CLOSING_SECOND 18

#define MODE3_OPENING_HOUR 19
#define MODE3_OPENING_MINUTE 20
#define MODE3_OPENING_SECOND 21
//String 
#define SSID_INDEX 0
#define PASS_INDEX 1
#define IP_INDEX 2
#define GATEWAY_INDEX 3
#define SUBNET_INDEX 4
#define DNS_INDEX 5

#define RELAY_IO_INDEX 6
#define LED_IO_INDEX 7
#define COMPUTER_STATE_IO_INDEX 8
#define COMPUTER_RST_IO_INDEX 9

#define CONTROL_MODE_INDEX 10

#define NTP_INDEX 11
#define BLINKER_AUTH_INDEX 12
#define BLINKER_ENABLE_INDEX 13
#define BEMFA_AUTH_INDEX 14
#define BEMFA_ENABLE_INDEX 15

void eeprom_clear();
void eeprom_read();
void eeprom_write();
int eeprom_get_int(int index);
String eeprom_get_string(int index);
long eeprom_get_mode2_opening_second();
long eeprom_get_mode2_closeing_second();
long eeprom_get_mode3_opening_second();